#@layoutT("数据库表")
#define main()
		<div class="layui-row layui-col-space1 task-row">
		  <div class="layui-col-xs12 layui-col-md12 div-scroll">
		  		#set(hide_xs=false)
            	#@formStart()
				  	<div class="layui-inline">
					  	<select id="configName" name="configName" class="layui-select" lay-filter="configName" >
							<option value="">主数据源</option>
							#for(data:dataSourceList)
							<option value="#(data.config_name??)">#(data.title??)</option>
							#end
						</select>
				  	</div> 
			  		<div class="layui-inline">
					   	<input type="search" name="name" autocomplete="off" class="layui-input" placeholder="表名查询"/>								
					</div>									
				#@formEnd()				
           		<table id="maingrid" lay-filter="maingrid"></table>
		</div>		  
	</div>
	
	<!-- 	每行的操作按钮 -->
	<script type="text/html" id="bar_maingrid">
  		<a class="layui-btn layui-btn-xs" lay-event="add">选择</a>
	</script>
#end

#define queryButton()
	<button class="layui-btn" type="button" onclick="clearSession()" style="margin-left: 5px!important;">
		<i class="layui-icon layui-icon-close"></i>清缓存
	</button>
#end

#define js()
<!-- 分页表格 -->
<script>
	function clearSession(){
		var url="#(path)/portal/generator/code/clearSession";
		$.post(url,null,function(ret){
			 layer.msg(ret.msg);
		});
	}
	layui.form.on('select(configName)', function(data){
		$('#searchBtn_').click();
	});

	//选择表格行数据
	 function getRowData(obj){
		 var checkStatus = table.checkStatus('maingrid'); // test即为基础参数id对应的值
		 var data=checkStatus.data;
		 if(data.length==0){
			data[0]=obj.data;
		 }
		 var configName=$('select[name=configName]').val();
		 parent.setTable(data,configName);
	 }

	gridArgs.title='数据库表';
	gridArgs.dataId='id';
	gridArgs.heightDiff=55;
	initGrid({id : 'maingrid'
			,elem : '#maingrid'
			,cellMinWidth: 80
			,cols : [ [
					{title: '主键',field : 'name',width : 35,checkbox : true},	
					{title: '序号',type : 'numbers',width : 50},						
					{title: '表名（只显示 w_ 前缀的表）', field: 'name',sort:true},
        			{title: '备注', field: 'remarks'},																												
					{title: '操作',fixed:'right',width : 100,align : 'left',toolbar : '#bar_maingrid'} // 这里的toolbar值是模板元素的选择器
			] ]
			,url:"#(path)/portal/generator/code/tablesList"
			,searchForm : 'searchForm'
			,where:{'skip':'w_'}
		},{add:getRowData});
	
</script>
#end

  